#define  _CRT_SECURE_NO_WARNINGS 1	
#include <stdio.h>
int main() {
    int count = 0;
    int n = 0;
    scanf("%d", &n);
    int p = 0;
    int q = n - 1;
    int arr[20][20] = { 0 };
    while (count < n * n)
    {
        for (int i = p; i <= q; i++)
            arr[p][i] = ++count;

        for (int i = p + 1; i <= q; i++)
            arr[i][q] = ++count;

        for (int i = q - 1; i >= p; i--)
            arr[q][i] = ++count;

        for (int i = q - 1; i >= p + 1; i--)
            arr[i][p] = ++count;
        ++p;
        --q;
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            printf("%d ", arr[i][j]);
        printf("\n");
    }
    return 0;
}